#pragma once
#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#endif

#define COLOR_DEEP 24
#define pi 3.14159265

#include "SDL.h"
#include "Position.h"
#include "Color.h"
#include "Texture.h"
#include "TriangularObstacle.h"
#include <map>

class SketcherHelper{
	public:	static SketcherHelper* getInstance();

	public: void initializeInstance(int width, int height, Color* backColor, Color* borderColor);
	public: void initializeInstance(int width, int height, Texture* texture, Color* borderColor);
	public: void drawCircle(Position* center, int radiuos, Color* backColor, Color* borderColor);
	public: void drawCircle(Position* center, int radiuos, Texture* backTexture, Color* borderColor);
	public: void drawSquare(Position* position, int width, int height, double angle, Color* backColor, Color* borderColor);
	public: void drawSquare(Position* position, int width, int height, double angle, Texture* backTexture, Color* borderColor);
	public: void drawTriangle(TriangularObstacle * triangle, Color * backGroundColor, Color * lineColor );
	public: void drawLine(Position* fromPosition,Position* toPosition, Color* backColor, Color* borderColor);
	public: double calcDist(Position from,Position to);
	public: double calcAngle(Position from,Position to);
	public: void show();
	public: void endInitialicing();
	public: void clearBackground(Position *p,int width,int height);
	public: void setCoefs(float coeficienteX, float coeficienteY, float coeficiente, int initialX, int initialY, int pixelsHeight);
	public: Position* getPositionInPixels(Position * position);
	public: Position* getPositionMeasurementUnit(Position * position);
	
	private: void drawSquareFromSurface(SDL_Surface* cuadrado,Position* position,double angle);
	private: void drawPixel(SDL_Surface* screen, Position position, Uint32 pixel);
	private: void drawPixel(SDL_Surface* screen, Position position, Color * color);
	private: Uint32 readPixel(SDL_Surface* source,Position position);
	private: SDL_Surface *SketcherHelper::scaleSurface(SDL_Surface *Surface, Uint16 Width, Uint16 Height);
	private: SDL_Surface *screen;
	private: SDL_Surface *background;
	private: void drawSquareFromSurface(SDL_Surface* cuadrado,double angle);
	private: static SketcherHelper * instance;
	private: map<string, SDL_Surface *> images;
	private: bool initScreen;
	private: float coeficienteX; float coeficienteY; float coeficiente; int initialX; int initialY; int pixelsHeight;
};
